/*
 * @Author: DaTree
 * @Date: 2020-11-18 15:18:44
 * @LastEditTime: 2020-11-18 15:39:44
 * @LastEditors: DaTree
 * @Description: DaTreeEdit
 * @FilePath: \auto-deploy\src\store\modules\socket.ts
 * @天将降大任于是人也，必先苦其心志，劳其筋骨，饿其体肤，空乏其身，行拂乱其所为。 ——《孟子•告子下》
 * @symbol_custom_string_obkoro1_copyright: Copyright ${now_year} DaTree
 */
interface States {
  socketClient: any
}

const state: States = {
  socketClient: null,
}
import { MutationTree, ActionTree } from 'vuex'

const mutations: MutationTree<any> = {
  // 校验
  SET_CLIENT({ state }, client: any): void {
    //void与java中类似，返回值的含义
    state.socketClient = client
  },
}

const actions: ActionTree<States, any> = {
  // 注册校验用户名
  setClient({ commit, state: States }, client: any) {
    commit('SET_CLIENT', client)
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
}
